package com.employee.controller;

import com.employee.pojo.dto.StarffScheduleDTO;
import com.employee.pojo.entry.Position;
import com.employee.pojo.result.Result;
import com.employee.pojo.vo.StaffScheduleVo;
import com.employee.service.StaffScheduleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class StaffScheduleController {
    @Autowired
    private StaffScheduleService staffScheduleService;
    @GetMapping("/getStaffSchedule")
    public Result<List<StaffScheduleVo>> getStaffSchedule() {
        List<StaffScheduleVo> staffSchedule = staffScheduleService.getStaffSchedule();
        return Result.success(staffSchedule);
    }
    @PostMapping("/updateStaffSche")
    public Result updateStaffSchedule(@RequestBody StarffScheduleDTO StarffScheduleDTO) {
        staffScheduleService.updateStaffSchedule(StarffScheduleDTO);
        return Result.success();
    }
    @GetMapping("/QuerySchedule")
    public Result<List<StaffScheduleVo>> selectPosition(@RequestParam("type") String type,
                                                        @RequestParam("username") String username,
                                                        @RequestParam("deptName") String deptName) {
        List<StaffScheduleVo> staffSchedule = staffScheduleService.selectSchedule(type,username, deptName);
        return Result.success(staffSchedule);
    }
}
